<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Manager Routes
|--------------------------------------------------------------------------
|
| Here is where you can register manager routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "token" middleware group. Enjoy building your manager!
|
*/
// 用户模块
Route::prefix('user')->group(function (){
    // 创建用户
    Route::post('store', 'UserController@store');
    // 删除用户
    Route::delete('destroy/{id}', 'UserController@destroy');
    // 更新用户
    Route::post('update/{id?}', 'UserController@update');
    // 用户信息
    Route::get('info/{id?}', 'UserController@show');
    // 用户列表
    Route::get('paginate', 'UserController@index');
    // 权限菜单
    Route::get('menus', 'UserController@menus');
    // 打印单据
    Route::get('print', 'UserController@print');
    // 导出
    Route::get('export', 'UserController@export');
    // 批量修改
    Route::post('update/all', 'UserController@updateAll');
    // 导入修改
    Route::post('importedit', 'UserImportController@importEdit');
    Route::get('importedit/file', 'UserImportController@editFilePaginate');
    Route::get('importedit/error', 'UserImportController@editErrorPaginate');
});
// 菜单模块
Route::prefix('menu')->group(function (){
    // 创建菜单
    Route::post('store', 'MenuController@store');
    // 删除节点
    Route::delete('destroy/{id}', 'MenuController@destroy');
    // 保存菜单
    Route::post('update/{id}', 'MenuController@update');
    // 菜单信息
    Route::get('info/{id}', 'MenuController@show');
    // 菜单列表
    Route::get('lists', 'MenuController@lists');
});
// 分组模块
Route::prefix('group')->group(function (){
    // 创建分组
    Route::post('store', 'GroupController@store');
    // 删除分组
    Route::delete('destroy/{id}', 'GroupController@destroy');
    // 保存分组
    Route::post('update/{id}', 'GroupController@update');
    // 分组信息
    Route::get('info/{id}', 'GroupController@show');
    // 分组列表
    Route::get('paginate', 'GroupController@paginate');
});
// 节点模块
Route::prefix('rule')->group(function (){
    // 创建节点
    Route::post('store', 'RuleController@store');
    // 删除节点
    Route::delete('destroy/{id}', 'RuleController@destroy');
    // 保存节点
    Route::post('update/{id}', 'RuleController@update');
    // 节点信息
    Route::get('info/{id}', 'RuleController@show');
    // 节点列表
    Route::get('lists', 'RuleController@lists');
});
// 配置管理
Route::prefix('config')->group(function (){
    // 获取配置
    Route::match(['get','post'], '/get', 'ConfigController@keyBy');
    // 更新配置
    Route::post('set/batch', 'ConfigController@updateBatch');
    // 短信配置
    Route::post('set/sms', 'ConfigController@updateSms');
    // 微信公众号
    Route::post('set/wechat_gzh', 'ConfigController@updateWechatGzh');
    // 微信小程序
    Route::post('set/wechat_xcx', 'ConfigController@updateWechatXcx');
});
// 商品模块
Route::prefix('goods')->group(function (){
    // 创建
    Route::post('store', 'GoodsController@store');
    // 删除
    Route::delete('destroy/{id}', 'GoodsController@destroy');
    // 更新
    Route::post('update/{id?}', 'GoodsController@update');
    // 详情
    Route::get('info/{id?}', 'GoodsController@show');
    // 列表
    Route::get('paginate', 'GoodsController@index');
    // 打印单据
    Route::get('print', 'GoodsController@print');
    // 导出
    Route::get('export', 'GoodsController@export');
    // 打印标签
    Route::get('print/label', 'GoodsController@printLabel');
    // 批量修改
    Route::post('update/all', 'GoodsController@updateAll');
    // 批量删除
    Route::delete('destroy/all', 'GoodsController@destroyAll');
    Route::post('import', 'GoodsImportController@import');
    Route::get('import/file', 'GoodsImportController@filePaginate');
    Route::get('import/error', 'GoodsImportController@errorPaginate');
    
    Route::post('importedit', 'GoodsImportController@importEdit');
    Route::get('importedit/file', 'GoodsImportController@editFilePaginate');
    Route::get('importedit/error', 'GoodsImportController@editErrorPaginate');
});
// 标场模块
Route::prefix('bid')->group(function (){
    // 创建
    Route::post('store', 'BidController@store');
    // 删除
    Route::delete('destroy/{id}', 'BidController@destroy');
    // 更新
    Route::post('update/{id?}', 'BidController@update');
    // 详情
    Route::get('info/{id?}', 'BidController@show');
    // 列表
    Route::get('paginate', 'BidController@index');

    // 投标竞价模块
    Route::prefix('goods')->group(function () {
        // 创建
        Route::post('store', 'BidGoodsController@store');
        // 列表
        Route::get('paginate', 'BidGoodsController@index');
        // 统计
        Route::get('summary', 'BidGoodsController@summary');
        // 统计
        Route::get('summary/user', 'BidGoodsController@summaryUser');
    });
});
// 货主模块
Route::prefix('supplier')->group(function (){
    // 创建
    Route::post('store', 'SupplierController@store');
    // 删除
    Route::delete('destroy/{id}', 'SupplierController@destroy');
    // 更新
    Route::post('update/{id?}', 'SupplierController@update');
    // 详情
    Route::get('info/{id?}', 'SupplierController@show');
    // 列表
    Route::get('paginate', 'SupplierController@index');
});
// 打印模板模块
Route::prefix('print/tpl')->group(function () {
    // 创建模板
    Route::post('store', 'PrintTplController@store');
    // 模板信息
    Route::get('info/{id}', 'PrintTplController@info');
    // 更新模板
    Route::post('update/{id}', 'PrintTplController@update');
    // 删除模板
    Route::delete('destroy/{id}', 'PrintTplController@destroy');
    // 模板分页
    Route::get('paginate', 'PrintTplController@paginate');
});
